package com.atguigu.ioc_02;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
//@Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON) //默认值 单例 JavaBean.init true JavaBean.destory 会管理销毁方法
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)//多例  JavaBean.init JavaBean.init false 不会管理销毁方法
@Component
public class JavaBean {
    @PostConstruct
    public void init(){
        System.out.println("JavaBean.init");
    }
    @PreDestroy
    public void destory(){
        System.out.println("JavaBean.destory");
    }
}
